<template>
          <div
        style="
          display: flex;
          border-bottom: 1px solid #f1f1f1;
          margin-bottom: 20px;
          padding: 10px 0px 0px 10px;
          flex-direction: column;
        "
      >
        <div style="display: flex; align-items: center">
          <el-checkbox @change="changeFuzzyQuery" v-model="fuzzyQuery"
            >模糊</el-checkbox
          >
          <el-button
            type="primary"
            :icon="Search"
            @click="getSelectData"
            style="margin-left: 10px"
            >查 询</el-button
          >
        </div>
        <div style="margin-top: 10px;">
        <sc-form
          ref="formRef"
          :config="formConfig"
          v-model="form"
          :fileName="fileName"
        >
        </sc-form>
      </div>
      </div>
</template>
<script setup>
import { ref, onMounted ,watch} from "vue";
import Api from "@/api/model/system";
const fuzzyQuery = ref(true);
const formConfig = ref([]);
const form = ref({});
const props = defineProps({
  widget:{type:Object,default:()=>{}},
  fileName: { type: String, default: "" },
});
const emit = defineEmits(['getData'])
onMounted(() => {
  getInit();
});
watch(()=> props.widget?.datasetId,()=>{
  getInit()
},{deep:false})
const getInit = async () => {
  let params = {
    fileName: props.fileName,
    datasetId:props.widget.datasetId
  };
  let res = await Api.report.selectCompanyList.post(params);
  if (res.code == 200) {
    formConfig.value = res.bean.form;
  }
};

const getSelectData = async()=>{
  emit('getData',form.value)
}
</script>